package com.sayimo.maker.base.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import com.sayimo.framework.exception.DaoException;
import com.sayimo.framework.exception.ServiceException;
import com.sayimo.maker.base.dao.FacebackDao;
import com.sayimo.maker.base.service.FacebackService;
import com.sayimo.maker.base.vo.Faceback;
import com.sayimo.maker.commons.Constant;

/**
 * @package com.sayimo.school.mall.module.base.service.impl
 * @author gongyijun
 * @Title:FacebackServiceImpl
 * @Description:
 * @date 2016年9月20日
 */
@Service(value="facebackService")
public class FacebackServiceImpl implements FacebackService {
	
	@Resource(name="facebackDao")
	private FacebackDao facebackDao;
	
	private static Log logger = LogFactory.getLog(FacebackServiceImpl.class);
	
	 /**
	 * @Package com.sayimo.school.mall.module.base.service.impl
	 * @Author 龚益君
	 * @MethodName:insertFaceback
	 * @Description:插入意见或者问题
	 * @param faceback
	 * @return
	 * @throws ServiceException
	 * @Date 2016年9月20日,下午2:37:02
	 */
	@Override
	public Map<String, Object> insertFaceback(Faceback faceback) throws ServiceException {
		Map<String,Object> resultMap = new HashMap<>();
		Integer result =null;
		try {
			Map<String,Object> dataMap = new HashMap<>();
			result=facebackDao.insertFaceback(faceback);
			if(result>0){
				dataMap.put(Constant.MSG, "插入成功");
				resultMap.put(Constant.STATUS, Constant.STATUS_SUCCESS);
				resultMap.put(Constant.DATA, dataMap);
			}else{
				resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
				resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
			}
		} catch (DaoException e) {
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR_CODE, Constant.SYSTEM_ERROR);
			logger.info(e);
			e.printStackTrace();
		}
		return resultMap;
	}

}
